function changeStatus() {
    var demandType = $("#demandType").val();
    $("#status").val(0);
    var myDem = $("#myDem").val();


    if (demandType == 0) {
        $("#searchForm").attr("action", "getAlldemand.html?myDem="+myDem);
        demandType = "全部"
    }
    if (demandType == 1) {

        $("#searchForm").attr("action", "allBugList.html?myDem="+myDem);
        demandType = "BUG"
    }

    if (demandType == 4) {
        $("#searchForm").attr("action", "allBugList.html?myDem="+myDem+"&bugType=2");
        demandType = "BUG"
    }

    if (demandType == 2) {
        $("#searchForm").attr("action", "demandList.html?myDem="+myDem);
        demandType = "需求"
    }

    if (demandType == 3) {
        $("#searchForm").attr("action", "opertionList.html?myDem="+myDem);
        demandType = "操作"
    }
    var beginTime = $("#beginTime").val();
    var finishBeginTime = $("#finishBeginTime").val();


    if ("" != beginTime){
        $("#endTime").val(beginTime.substring(13));
        $("#beginTime").val(beginTime.substring(0,10));

    }

    if ("" != finishBeginTime){
        $("#finishEndTime").val(finishBeginTime.substring(13));
        $("#finishBeginTime").val(finishBeginTime.substring(0,10));
    }
    $("#searchForm").submit();
}



function queryDemand() {
    var demandType = $("#demandType").val();
    var myDem = $("#myDem").val();


    if (demandType == 0) {
        $("#searchForm").attr("action", "getAlldemand.html?myDem="+myDem);
        demandType = "全部"
    }
    if (demandType == 1) {

        $("#searchForm").attr("action", "allBugList.html?myDem="+myDem);
        demandType = "BUG"
    }
    if (demandType == 4) {
        $("#searchForm").attr("action", "allBugList.html?myDem="+myDem+"&bugType=2");
        demandType = "BUG"
    }

    if (demandType == 2) {
        $("#searchForm").attr("action", "demandList.html?myDem="+myDem);
        demandType = "需求"
    }

    if (demandType == 3) {
        $("#searchForm").attr("action", "opertionList.html?myDem="+myDem);
        demandType = "操作"
    }
    if ("" != $("#status").multipleSelect("getSelects")){
        $("#status").val($("#status").multipleSelect("getSelects"));
    }

    // alert($("#status").multipleSelect("getSelects"))
    var beginTime = $("#beginTime").val();
    var finishBeginTime = $("#finishBeginTime").val();


    if ("" != beginTime){
        $("#endTime").val(beginTime.substring(13));
        $("#beginTime").val(beginTime.substring(0,10));

    }

    if ("" != finishBeginTime){
        $("#finishEndTime").val(finishBeginTime.substring(13));
        $("#finishBeginTime").val(finishBeginTime.substring(0,10));
    }
    $("#searchForm").submit();
}


var param = "";
$(function () {
    var index = 0;
    //双击tr弹出页面
    $("#cusTable tr td").dblclick(function () {

        var demandType = $(this).parent('tr').attr('demandType');
        var content = "";
        if (demandType == 1) {
            content = 'bugDetail.html?bugId=';
            demandType = "BUG"
        }

        if (demandType == 2) {
            content = 'demandDetail.html?demandId=';
            demandType = "需求"
        }

        if (demandType == 3) {
            content = 'operationDetail.html?id=';
            demandType = "操作"
        }
        //alert($(this).html());
        //alert($(this).attr('custId'));
        //alert($(this).parent('tr').attr('custId'));
        var title = demandType + "-" + $(this).parent('tr').attr('statusText');
        index = layer.open({
            type: 2,
            title: title,
            skin: 'ilayui-layer-rm', //加上边框
            area: ['90%', '90%'], //宽高
            content: content + $(this).parent('tr').attr('id'),
//                end: function () {
//                    location.reload();
//                }
        });
    });


    //单击tr弹出详细页面
    $("[id=searchBtn]").click(function () {

        var demandType = $(this).attr('demandType');
        var content = "";
        if (demandType == 1) {
            content = 'bugDetail.html?bugId=';
            demandType = "BUG"
        }

        if (demandType == 2) {
            content = 'demandDetail.html?demandId=';
            demandType = "需求"
        }

        if (demandType == 3) {
            content = 'operationDetail.html?id=';
            demandType = "操作"
        }
        //alert($(this).html());
        //alert($(this).attr('custId'));
        //alert($(this).parent('tr').attr('custId'));
        var title = demandType + "-" + $(this).attr('statusText');
        index = layer.open({
            type: 2,
            title: title,
            skin: 'ilayui-layer-rm', //加上边框
            area: ['90%', '90%'], //宽高
            content: content + $(this).attr('demId'),
//                end: function () {
//                    location.reload();
//                }
        });
    });
});

function clearForms() {
    $('#createName').val("");
    $('#demandProduct').val("0");
    $('#status').val("0");
    $('#feedbackCity').val("0");
    $("#status").multipleSelect("refresh");
    $("#feedbackCity").multipleSelect("refresh");
    $('#title').val("0");
    $("#title").multipleSelect("refresh");
    $('#beginTime').val("");
    $('#detail').val("");
    $('#endTime').val("");
    $('#joinName').val("");
    $('#currentPrincipal').val("");
    $('#isSuspend').val("0");
    $('#priority').val("0");
    $('#feedbackName').val("");
    $('#feedbackCity').val("");
    $('#finishEndTime').val("");
    $('#finishBeginTime').val("");
    $('#demId').val("");
}

// $("#resetBut").click(function () {
//     $('#createName').val("");
//     $('#demandProduct').val("0");
//     $('#status').val("0");
//     $('#beginTime').val("");
//     $('#detail').val("");
//     $('#endTime').val("");
//     $('#joinName').val("");
//     $('#currentPrincipal').val("");
//     $('#isSuspend').val("0");
// });
